/**
 * Created by Aranld on 2017/5/10.
 */
let userDao = require('../mysql/userDao.js');
let md5 = require('md5');
let variable = require('../data/variable.js');
let msg = require('../util/msg.js');
let log = require('../util/log.js');
//let login = require('./login.js');
let enter = require('./enter.js');

module.exports = action;

function action(obj, cid) {
    let data = obj.data;
    switch (obj.action) {
        case 'enterToken':
            if (!data.token) {
                msg.send(cid, obj.uuid, 'error', {'api': 'enterToken', 'code': 10019});
                return false;
            }
            new enter(cid,obj.uuid,data.token);
            //login.enter(cid, obj.uuid, data);
            break;
        case 'enterLogout':
            msg.send(cid, obj.uuid, 'enterLogout');
            break;
        case 'enterServerTime':
            msg.send(cid, obj.uuid, 'enterServerTime', {'time': (Date.now())});
            break;
    }
}